package kr.ac.ajou.se.team1.helloworld;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import kr.ac.ajou.se.team1.helloworld.adapters.OurExpandableListAdapter;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ExpandableListView;

public class EnterPatientInformation extends Activity {

	private ExpandableListView listView;
	private OurExpandableListAdapter adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_enter_patient_information);
		
		listView = (ExpandableListView) findViewById (R.id.patientInformationListView);
		
		
		/**
		 * These codes are made to exploit.
		 */
		
		ArrayList<String> listHeaders = new ArrayList<String>();
		HashMap<String, List<String>> childs = new HashMap<String, List<String>>();
		
		//Set Headers
		listHeaders.add("Allergies");
		listHeaders.add("Medicines Currently Taking");
		listHeaders.add("Symptoms");
		//listHeaders = this.getResources().getStringArray(R.array.patientInformationGroup);
		
		//Putting Dummies into each list
		ArrayList<String> allergies = new ArrayList<String>();
		allergies.add("Allergy 1");
		allergies.add("Allergy 2");
		allergies.add("Allergy 3");
		
		ArrayList<String> medicines = new ArrayList<String>();
		medicines.add("Medicine 1");
		medicines.add("Medicine 2");
		medicines.add("Medicine 3");
		
		ArrayList<String> symptoms = new ArrayList<String>();
		symptoms.add("Symptom 1");
		symptoms.add("Symptom 2");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		symptoms.add("Symptom 3");
		
		//Put Header and Child Data
		childs.put(listHeaders.get(0), allergies);
		childs.put(listHeaders.get(1), medicines);
		childs.put(listHeaders.get(2), symptoms);
		
		adapter = new OurExpandableListAdapter(this, listHeaders, childs);
		
		//Set adapter into given Expandable List View
		listView.setAdapter(adapter);
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.enter_patient_information, menu);
		return true;
	}

}
